FROM continuumio/miniconda3:23.5.2-0


RUN apt-get update && apt-get install locate sudo

RUN conda create -n env python=3.10
RUN conda init bash


# RUN cd / | tar -czvf venv.tar.gz venv

# Copy requirements.txt and install dependencies
COPY requirements.txt .
RUN conda run -n env pip install --no-cache-dir  -r requirements.txt
RUN pip install --no-cache-dir conda-pack
# RUN cd /venv && tar -czvf ../venv.tar.gz * && chmod 777 ../venv.tar.gz
# RUN stat /venv.tar.gz

RUN conda-pack -n env -o /venv.tar.gz && chmod 777 /venv.tar.gz

# set new user 
RUN echo "meowuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& groupadd -g 9882 meowuser && useradd -u 9882 -g 9882 meowuser

RUN echo "meowuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Create the home directory for meowuser
RUN mkdir -p /home/meowuser && \
    chown meowuser:meowuser /home/meowuser

# Set the working directory to /home/meowuser
WORKDIR /home/meowuser


USER meowuser

RUN cp /venv.tar.gz /home/meowuser
# Copy the rest of the application code
COPY app.py /home/meowuser


# tar -czvf archive.tar.gz folder_name

# Set the command to run the application
CMD [ "python", "app.py" ]